package com.hksj.drcs.enums;

import lombok.Getter;

/**
 * @author zengke
 * @version 1.0
 * @see LoopTypeEnum
 * @since 2025/05/22 18:02
 */

@Getter
public enum LoopTypeEnum {

    UV(1, "紫外线"),
    BIOLOGICAL_SAFETY_GUARD(2, "生物安全柜"),
    HORIZONTAL_FLOW_TABLE(3, "水平层流台");

    private Integer code;

    private String name;

    LoopTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    /**
     * 根据code获取枚举
     * @param code 当前的code
     * @return code对应的枚举项
     */
    public static String getNameByCode(Integer code) {
        for (LoopTypeEnum loopTypeEnum : LoopTypeEnum.values()) {
            if (loopTypeEnum.getCode().equals(code)) {
                return loopTypeEnum.getName();
            }
        }
        return null;
    }
}
